
<div id="view">
<table class="TableView" cellspacing="1" style="font-size:11px;">
<tr class="trHeader">
    <!--<td><input type="checkbox" id="chkSelectAll" onclick="checkAll(this)" /></td>-->
    <td>Hình ảnh</td>
    <td style="width:300px">Tên Tivi</td>
    <!--<td>Kích thước</td>-->
    <td style="width:110px">Giá</td>
    
    
</tr>
<?php
    $i = 0;
    foreach($lstTivi as $item){
        if($i%2==0){
?>		
            <tr class="trOdd">

            
<?php	
        }
        else{
?>
            <tr class="trEven">
<?php		
        }
?>
<!--<td ><input type="checkbox" id="chkSelect<?php echo $i?>" name="chkSelect" onclick="Check_Click(this)" /></td>-->
<td style="text-align:left"><img id="<?php echo $item->id ?>" name="<?php echo $item->TenTivi ?>" src="<?php echo __URL_BASE.'images/'.utility::setImageThumb($item->Images,$item->Images2,$item->Images3,$item->Images4,$item->Images5); ?>" style="max-width:180px;max-height:50px;cursor:pointer;" onclick="getTivi(this);" /></td>
<td><?php echo $item->TenTivi ?></td>
<!--<td style="padding: 0 10px;"><span style="font-weight:bold">Kích Thước:</span> <?php echo $item->KichThuoc ?> inches
    <br /><span style="font-weight:bold">Độ phân giải:</span> <?php echo $item->PhanGiai ?>
</td>-->
<td style="padding:0 5px;"><span><?php echo number_format($item->GiaBan,0,'','.')?> đ</span>
    <br /><span style="text-decoration:line-through;color:#999"><?php echo number_format($item->GiaThat,0,'','.')?> đ</span>
</td>
</tr>	
<?php
        $i++;
    }
?>


</table>

<div class="pagination">
    <?php
        if($pages > 1){
    ?>
            <p>
            <?php
                if($cur > 1){
            ?>	
                    <a id="prevpag2" name="<?php echo $cur?>" ><< prev</a>
            <?php
                }
                else{
            ?>
                    <span  class="disabled" ><< prev</span>
            <?php	
                }
            ?>
                
                <?php
                    for($i=1;$i<=$pages;$i++){
                        if($cur == $i){
                ?>
                            <span  class="current" ><?php echo $i?></span>
                <?php		
                        }
                        else{
                ?>
                            <a  class="pag2"><?php echo $i?></a>
                <?php		
                        }
                    }
                    if($cur < $pages){
                ?>
                        <a id="nextpag2" name="<?php echo $cur?>" >next >></a>
                <?php	
                    }
                    else{
                ?>
                        <span  class="disabled" >next >></span>
                <?php	
                    }
                ?>
                
                <input type="hidden" id="curpag2" value="<?php echo $cur?>" />
            </p>
    <?php	
        }
    ?>
    
  </div>
</div>
<script>
	$(document).on("click",".pag2",function(){
		debugger;
		var current = this.innerHTML;
		//alert(current);
		$("#view").html("");
		$('#view').html("<img src='<?php echo __URL_BASE ?>img/loader.gif' style='position: absolute;top: 50%;left: 50%;margin-left: -110px;margin-top: -10px;'/>").fadeIn('fast'); 
		$.ajax ({
			type: "POST",
			url: '<?php echo __URL_BASE?>index.php?rt=admin_order/load_tivi',
			data: {cur: current},
			success: function(data_page) { 
				//$('#view').fadeOut('fast');
				$("#view").html(data_page);  
			}
		});
	});
	
	$(document).on("click","#nextpag2",function(){
		debugger;
		var current = this.attr("name") + 1;
		//alert(current);
		$("#view").html("");
		$('#view').html("<img src='<?php echo __URL_BASE ?>img/loader.gif' style='position: absolute;top: 50%;left: 50%;margin-left: -110px;margin-top: -10px;'/>").fadeIn('fast'); 
		$.ajax ({
			type: "POST",
			url: '<?php echo __URL_BASE?>index.php?rt=admin_order/load_tivi',
			data: {cur: current},
			success: function(data_page) { 
				//$('#view').fadeOut('fast');
				$("#view").html(data_page);  
			}
		});
	});
	
	function getTivi(x){
		book = '<?php echo $_POST['book'];  ?>';
		var name =x.name;
		//alert(name);
		$("#"+book).val(name);
		$("#group .slg").each(function(){
			if($(this).attr('class').indexOf(book)>=0){
				$(this).attr('name','qty['+x.id+']');
				$(this).val('1');
			}
				
				
		});
		$( "#products" ).dialog( "close" );
	}
</script>
